# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=autoconf
pkgver=2.69
pkgrel=3
pkgdesc="A GNU tool for automatically configuring source code"
arch=('any')
license=('GPL2' 'GPL3' 'custom')
url="http://www.gnu.org/software/autoconf"
groups=('base-devel')
depends=('awk' 'm4' 'diffutils' 'bash')
# for test-suite
makedepends=('gcc-fortran')
install=autoconf.install
source=(ftp://ftp.gnu.org/pub/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig}
        0001-fix-texinfo.patch
        0002-msys2.patch
        0003-autotest-remove-cr-from-prog-stdout-stderr.patch)
md5sums=('50f97f4159805e374639a73e2636f22e'
         'SKIP'
         '680649703204fd748a6bf068e9bf7085'
         '6f39b8f28a7d94976a3cdd5a055d1870'
         'f176391db3b6886fafab01d4fc88d77f')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/0001-fix-texinfo.patch
  patch -p1 -i ${srcdir}/0002-msys2.patch
  patch -p1 -i ${srcdir}/0003-autotest-remove-cr-from-prog-stdout-stderr.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  ./configure --prefix=/usr
  make
}

check() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make check
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install

  # license exception
  install -Dm644 COPYING.EXCEPTION \
    $pkgdir/usr/share/licenses/autoconf/COPYING.EXCEPTION

  # conflict with bintuils
  rm -f ${pkgdir}/usr/share/info/standards.info
}
